#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pb push_back
#define rep(i, x, y) for(int i = (x); i <= (y); i++)
#define per(i, x, y) for(int i = (x); i >= (y); i--)

using namespace std;

typedef long long ll;
typedef double db;
typedef vector < int > vec;
typedef pair < int , int > pii;

int read() {
    int x = 0; bool f = 0; char ch = getchar(); while(!isdigit(ch)) f |= ch == '-',ch = getchar();
    while(isdigit(ch)) x = x * 10 + (ch ^ 48),ch = getchar(); return f ? -x : x;
}

const int N = 110;

bool f[N * N];
int n, s[N];

int main() {
#ifndef ONLINE_JUDGE
    freopen("1.in","r",stdin);
#endif
	n = in; rep(i, 1, n) s[i] = in;
	f[0] = 1; int l = n * 100;
	rep(i, 1, n) {
		per(j, l - s[i], 0) {
			f[j + s[i]] |= f[j];
		}
	}
	per(i, l, 0) if(i % 10 && f[i]) return printf("%d\n", i), 0;
	printf("%d\n", 0);
	return 0;
}
